

<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@include file="/pageRc/common/common.jsp"%>

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta name="viewport" content="initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
	<meta name="format-detection" content="telephone=no">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="mobile-web-app-capable" content="yes">
	<meta name="msapplication-tap-highlight" content="no">
	<script type="text/javascript" src="<%=commonPath %>/pageRc/js/jquery-1.9.1.min.js"></script> 
 　	<link rel="stylesheet" href="<%=commonPath %>/pageRc/layui/css/layui.css" media="all">
 　　　<script type="text/javascript" src="<%=commonPath %>/pageRc/common/utils.js"></script>
	<script type="text/javascript" src="<%=commonPath %>/pageRc/common/msgTool.js"></script>
	<script type="text/javascript" src="<%=commonPath %>/pageRc/layui/layui.js"></script>　
	<script type="text/javascript"
	src="<%=commonPath %>/pageRc/My97DatePicker/WdatePicker.js"></script>
	<title>上线</title> 
	<style>
.Wdate {
    border: #efefef 1px solid;
    height: 35px;
    width: 190px;
    background: #ffffff url(datePicker.gif) no-repeat right;
}
</style>
	<script type="text/javascript">
	var path = "<%=commonPath%>";
	var msg =new msgTool(); 
	$(document).ready(function(){
		$("#datePicker1").empty().html('<input type="text" id="months" name="month" class="Wdate" onClick="WdatePicker({months:\'%y-%M\',dateFmt:\'yyyyMM\'})"/>');
});
	
	</script>
</head>

 <body style="layui-main">
  <div class="layui-form-item">
 <form  id="createMsgForm" name="createMsgForm"  class="layui-form"  style="padding:1.5rem"  >
             <input id="needid"  name = "needid"  value="${needBean.rouid}"  type="hidden">
             <input id="proTeamNo"  name = "proTeamNo"  value="${needBean.proTeamNo}"  type="hidden">
             <input id="needNo"  name = "needNo"  value="${needBean.needNo}"  type="hidden">
             <input id="needName"  name = "needName"  value="${needBean.needName}"  type="hidden">
             <%--  <div class="layui-inline">
		      <label class="layui-form-label">总工时</label>
		       <div class="layui-inline">
             <input id="nTime"  name = "nTime"  value="${nTime}" disabled="true">
             		</div>
		</div>
		<div class="layui-inline">
		      <label class="layui-form-label">可上线工时 </label>
		       <div class="layui-inline">
             <input id="return_nTime"  name = "return_nTime"  value="${return_nTime}" disabled="true">
			    		</div>
		</div> --%>
		<div class="layui-inline">
			<label class="layui-form-label">总工时</label>
			<div class="layui-input-inline">
				<input type="text" id="nTime" name="nTime" value="${nTime}" disabled="true"
					 autocomplete="off" class="layui-input">
			</div>
		</div>
		<div class="layui-inline">
			<label class="layui-form-label">可上线工时</label>
			<div class="layui-input-inline">
				<input type="text" id="return_nTime" name="return_nTime" value="${return_nTime}" disabled="true"
					 autocomplete="off" class="layui-input">
			</div>
		</div>
		
		
			 <div class="layui-form-item">
			 <div class="layui-inline">
		      <label class="layui-form-label">月份 </label>
		       <!-- <div class="layui-input-inline">
					<select name="months" id="months" style="width: 210;">
						<option value="1月份">1月份</option>
						<option value="2月份">2月份</option>
						<option value="3月份">3月份</option>
						<option value="4月份">4月份</option>
						<option value="5月份">5月份</option>
						<option value="6月份">6月份</option>
						<option value="7月份">7月份</option>
						<option value="8月份">8月份</option>
						<option value="9月份">9月份</option>
						<option value="10月份">10月份</option>
						<option value="11月份">11月份</option>
						<option value="12月份">12月份</option>
					</select>
				</div> -->
					<div id="datePicker1" class="layui-input-inline">
			                <input type="text" id="months" name="month" class="Wdate" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" />
		                   </div>
		</div>
		<div class="layui-inline">
			<label class="layui-form-label">录入工时</label>
			<div class="layui-input-inline">
				<input type="text" id="needTime" name="needTime" placeholder="请输入录入工时(小时)"
					required lay-verify="required" autocomplete="off" class="layui-input">
			</div>
		</div>
		
				<div class="layui-inline">
						<button class="layui-btn" lay-filter="submitData" lay-submit>新增</button>
					</div>
			  </form> 
			  </div>
			  </div>
 
 <table class="layui-table" lay-even="" lay-skin="nob">
  <colgroup>
    <col width="30%">
    <col width="15%">
    <col width="15%">
    <col width="15%">
    <col width="15%">
    <col>
  </colgroup>
  <thead>
    <tr>
      <th>需求名称</th>
      <th>需求编号</th>
      <th>月份</th>
      <th>上线工时</th>
      <th>操作</th>
    </tr> 
  </thead>
  <tbody>
   <c:forEach items="${needList}" var="need">
			<tr>
				<td>${need.needName}</td>
				<td>${need.needNo}</td>
				<td>${need.months}</td>
				<td>${need.needTime}</td>
				<td><button class="layui-btn" type="button" onclick="deleteneed('${need.rouid}')">删除</button></td>
			</tr>
		</c:forEach>
  </tbody>
</table> 
 
<script> 
  layui.use(
		[ 'form', 'layer', 'laytpl', 'laypage','laydate' ],
		 function(){
			var form = layui.form(),
			layer = layui.layer;
			 var index = parent.layer.getFrameIndex(window.name); //获取当前窗体索引
			
			form.on('submit(submitData)',function(data){
				var field = data.field;
				//var now_nTime=${now_nTime};
				var dataObj = {
		  						"needid" : $("#needid").val(),
		  						"proTeamNo" : $("#proTeamNo").val(),
		  						"needNo" : $("#needNo").val(),
		  						"needName" : $("#needName").val(),
		  						"months" : $("#months").val(),
		  						"needTime" : $("#needTime").val()
		  						
		  					
		  					};
				var return_nTime=${return_nTime};
			
				if(field.needTime<=return_nTime){//判断录入的金额和是否大于评估工时
					  msg.sendMsg("/page/need/updateOnlineNeed.do", dataObj, function (data) {
			                layer.alert("新增成功！", function () {
			                    window.parent.flush();
			                    parent.layer.close(index); //执行关闭
			                });
			            });
					  
				}else{
					
				alert("录入工时大于评估工时")
				}
				
			});
});
  function deleteneed(rouid){
			 var jsonDate = {};
		        jsonDate.rouid = rouid;
		      
			        msg.sendMsg("/page/need/dodeleteOnlineNeed.do", jsonDate, function (data) {
			        	   layer.alert("删除成功！", function () {
			        		   location.reload();
			                });
			                
			        });
		    }
		 

  function custom_close(){
	  window.opener=null;
	  window.open('','_self');
	  window.close();
  }
</script>
</body>
</html>
 
 